<template>
  <div class="app-container">
    <el-button type="primary" @click="goBack">返回</el-button>
    <el-button type="warning" @click="exportHouse" v-hasPermi="['departure:electricStuRoster:dormExport']">导出</el-button>
    <div class="title-top">
      <div class="room" v-for="(v, i) in roomList" :key="i">
       <div class="title-room">
        <div>{{ v.houseName }}</div>
          <div>退费金额合计：{{ v.compAmount }}元</div>
       </div>
          
        <div style="display: flex;justify-content: space-between;flex-wrap: wrap;">
          <div
            class="title-dorm"
            v-for="(item, index) in v.roomAmounts"
            :key="index"
          >
          <div>
                <div style="display: flex; justify-content: space-between;">
                <div>{{ item.roomName }}宿舍</div>
                <div>{{ item.rsNumber }}人</div>
              </div>
              <div>退费金额：{{ item.rfAmount }}</div>
          </div>
          </div>
              
        </div>
      </div>
    </div>
  </div>
</template>       
      <script>
import { dormHouseRoom } from "@/api/departure/electricity";
export default {
  props: {},
  data() {
    return {
      roomList: [],
      form: {},
    };
  },

  created() {
    dormHouseRoom({dgsId:this.$route.query.dgsId}).then((res) => {
      this.roomList = res.data;
    });
  },
  methods: {
     // 返回上一级
     goBack() {
      this.$router.go(-1)
    },
     /** 导出按钮操作 */
     exportHouse() {
      this.download(
        "/departure/electricStuRoster/dormExport",
        {
          dgsId:this.$route.query.dgsId,
        },
        `宿舍电费${new Date().getTime()}.xlsx`
      );
    },
  },
};
</script>
      <style lang="scss" scoped>
.title-top {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  font-size: 14px;
  
}
.room {
  width: 49%;
  height: 200px;
  padding: 10px;
  border: 1px solid #d0d0d0;
  overflow: auto;
  margin: 5px;
}
.title-room {
  display: flex;
  justify-content: space-between;
}
.title-dorm {

  width: 23%;
  background-color: #efefef;
  padding: 5px;
  margin: 5px;
}

</style>